package com.lframework.xingyun.sc.controller.army;

import com.lframework.starter.web.annotations.OpenApi;
import com.lframework.xingyun.sc.dto.army.BillDetailQueryDTO;
import com.lframework.xingyun.sc.service.army.BillExportService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.servlet.http.HttpServletResponse;

/**
 * 部队
 */
@RequestMapping("/army")
@RestController
public class ArmyController {

    @Autowired
    private BillExportService billExportService;

    /**
     * 分队送货单
     * @param queryDTO
     * @param response
     */
    @OpenApi
    @PostMapping("/exportFenDan.json")
    public void exportFenDan(@RequestBody BillDetailQueryDTO queryDTO, HttpServletResponse response) {
        billExportService.exportFenDan(queryDTO.getDs(), response);
    }

    /**
     * 销售单
     * @param queryDTO
     * @param response
     */
    @OpenApi
    @PostMapping("/exportDaDui.json")
    public void exportDaDui(@RequestBody BillDetailQueryDTO queryDTO, HttpServletResponse response) {
        billExportService.exportDaDui(queryDTO.getDs(), response);
    }

    /**
     * 肉类米线单
     * @param queryDTO
     * @param response
     */
    @OpenApi
    @PostMapping("/exportRouLei.json")
    public void exportRouLei(@RequestBody BillDetailQueryDTO queryDTO, HttpServletResponse response) {
        billExportService.exportRouLei(queryDTO.getDs(), response);
    }
}
